// 用动态import 导入路由组件实现路由懒加载
// 当打包构建应用时， JavaScript 包会变得非常大， 影响页面加载。 
// 如果我们能把不同路由对应的组件分割成不同的代码块， 
// 然后当路由被访问的时候才加载对应组件， 这样就更加高效了。



// group-home-welcome组
// import Login from '../page/Login/Login.vue'
const Login = () => import( /* webpackChunkName: "group-home-welcome" */ '../page/Login/Login.vue')
// import Home from '../page/Home/Home.vue'
const Home = () => import( /* webpackChunkName: "group-home-welcome" */ '../page/Home/Home.vue')
// import Welcome from '../page/Welcome/Welcome.vue'
const Welcome = () => import( /* webpackChunkName: "group-home-welcome" */ '../page/Welcome/Welcome.vue')


// group-roles组
// import Users from '../page/Users/Users.vue'
const Users = () => import( /* webpackChunkName: "group-roles" */ '../page/Users/Users.vue')
// import Roles from '../page/power/Roles.vue'
const Roles = () => import( /* webpackChunkName: "group-roles" */ '../page/power/Roles.vue')
// import Rights from '../page/power/Rights.vue'
const Rights = () => import( /* webpackChunkName: "group-roles" */ '../page/power/Rights.vue')

// group-goods组
// import Categories from '../page/goods/Categories.vue'
const Categories = () => import( /* webpackChunkName: "group-goods" */ '../page/goods/Categories.vue')
// import Params from '../page/goods/Params.vue'
const Params = () => import( /* webpackChunkName: "group-goods" */ '../page/goods/Params.vue')
// import GoodsList from '../page/goods/GoodsList.vue'
const GoodsList = () => import( /* webpackChunkName: "group-goods" */ '../page/goods/GoodsList.vue')
// import AddGoods from '../page/goods/AddGoods.vue'
const AddGoods = () => import( /* webpackChunkName: "group-goods" */ '../page/goods/AddGoods.vue')

//group-Orders-Report组
// import Orders from '../page/Orders/Orders.vue'
const Orders = () => import( /* webpackChunkName: "group-Orders-Report" */ '../page/Orders/Orders.vue')
// import Report from '../page/report/Report.vue'
const Report = () => import( /* webpackChunkName: "group-Orders-Report" */ '../page/report/Report.vue')

export default [{
    path: '/login',
    component: Login,
    name: 'login',
  },
  {
    path: '/home',
    component: Home,
    name: 'home',
    children: [{
        path: '/users',
        component: Users,
        name: 'users',
      },
      {
        path: '/roles',
        component: Roles,
        name: 'roles',
      }, {
        path: '/rights',
        component: Rights,
        name: 'rights',
      },
      {
        path: '/categories',
        component: Categories,
        name: 'categories',
      }, {
        path: '/params',
        component: Params,
        name: 'params',
      },
      {
        path: '/goods',
        component: GoodsList,
        name: 'goodslist',

      }, {
        path: '/goods/add',
        component: AddGoods,
        name: 'addgoods'
      },
      {
        path: '/orders',
        component: Orders,
        name: 'orders'
      },
      {
        path: '/reports',
        component: Report,
        name: 'report'
      }, {
        path: '', //啥都不写的话。默认是父请的路由地址
        component: Welcome,
        name: 'welcome',
      },
    ]
  },
  {
    path: '/',
    redirect: '/login',
  }
]